#! 客户端post form：curl -X POST http://192.168.14.107:5000/submit -d "user=zhangsan"
#! 客户端post json：curl -X POST http://192.168.14.107:5000/submit -H "Content-Type: application/json" -d '{"user": "zhangsan"}'

from flask import Flask, request

app = Flask(__name__)

@app.route('/submit', methods=['POST'])
def submit():
    print("Content-Type:", request.content_type)
    if (request.is_json):
        print("JSON data:", request.get_json())
    else:
        print("Form data:", request.form)
    return "Form submitted successfully!"

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')